function toSubmit(){
	$.ajax({
		url:"demoServlet",
		type:"POST",
		dataType:"JSON",
		data:$('#formId').serialize(),
		async: false,
		success:function(data){
			//alert(data.categories);
			
			$('#container').highcharts({
				chart: {
		            type: 'spline'
		        },
				title : {
					text : '液体肥复配表'
				},

				xAxis : {
					title: {text: '生育期 '}, 
					categories: data.categories,
					labels: {
		                /* formatter: function () {
		                    return this.value + '天';
		                } */
		            },
					tickInterval : 1
				},

				yAxis : {
					title: {text: '需肥量 '}, 
					labels: {
		                formatter: function () {
		                    return this.value>0? this.value+ '(Kg/L)':this.value;
		                }
		            },
					//type : 'logarithmic',
					minorTickInterval : 0.1
				},

				tooltip : {
					//headerFormat : '<b>{series.name}</b><br />',
					pointFormat : '<b>{series.name}: </b>需肥量 {point.y} Kg/L<br />',
					crosshairs: true,
		            shared: true
				},
				series : [ 
				
				{
					name: 'K（钾）溶液',
					marker: {
		                symbol: 'square'
		            },
					data : data.soil_k_arr,
					pointStart : 1
				},
				{
					name: 'P（磷）溶液',
					marker: {
		                symbol: 'square'
		            },
					data : data.soil_p_arr,
					pointStart : 1
				},
				{
					name: 'N（氮）溶液',
					marker: {
		                symbol: 'square'
		            },
					data : data.soil_n_arr,
					pointStart : 1
				} 
				]
			});
			
		}
	});
}

function replaceAll(str){
	if (str != null)
		str = str.replace(/"/g, "");
	return str;
}
function createLabels() {
		var lableId = document.getElementById("add");
		lableId.innerHTML="";
		var cycle = Number(document.getElementById("cycle").value);
		for(var i=1;i<cycle;i++){
			lableId.innerHTML+="<span  style='float: left;' >第"+Number(i+1)+"周期所需肥料:</span>";
			lableId.innerHTML+="<input id='soil_n_"+i+"' type='text' name='soil_n_"+i+"' placeholder='氮' style='width:55px;float: left;'/>";
			lableId.innerHTML+="<input id='soil_p_"+i+"' type='text' name='soil_p_"+i+"' placeholder='磷' style='width:55px;float: left;'/>";
			lableId.innerHTML+="<input id='soil_k_"+i+"' type='text' name='soil_k_"+i+"' placeholder='钾' style='width:55px;'/>";
		}
	}